-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix revealer using unmap event #187
Conversation
I'll need a little time to get up to speed with the code base before reviewing ... |
I can confirm that it fixes the problem - I'll have a think about whether a more elegant solution exists. |
@peteruithoven : A simple solution that seems to work is to add an Idle loop in IndicatorMenubar.apply_new_order (). Then you can remove all the related Timeouts in Indicator.vala. |
I'm afraid that when I remove the timeout stuff and change the
Maybe there is a better way to make the reorder call cancelable than with a timeout? |
@peteruithoven: OK, I guess it must depend on hardware characteristics - I could not trigger the bug using a simple Idle (but I could only occasionally trigger it in master anyway). You could try using Idle.add_full with GLib.Priority.LOW and/or also keep a reference to the source id so that you can cancel the Idle if apply_new_order is called too rapidly. It seems that the fix should be kept within IndicatorMenubar if possible even if it means using a Timeout there. There are probably more complex solutions using async functions and cancellables and/or mutexes. |
Don't forget to install the changes and restart wingpanel - I have sometimes forgotten! |
I'm happy to report that that seems to work. Did I implement it like you meant it? I kind of prevent that mistake by temporarily removing wingpanel from the monitored list of cerbere and using the following the following command to compile and run: |
Good that it works! The only minor problem is that it will give critical warnings in the terminal if the source no longer exists when you try to remove it so you need to test whether it is greater than zero before removing it and set it to zero at the end of the Idle closure. The id should also have a default value of zero. |
@peteruithoven : Could you try this?
It works for me. |
Ah! I see you have already pushed some changes before I edited my comment - sorry. |
@jeremypw thanks I forgot about that error, I've added a check. You're last suggestion prevents the Revealer hide animation, because it's removed immediately? |
Ah, OK. I'll approve as is then. |
Fixes: elementary/wingpanel-indicator-bluetooth#64
Supersedes: #174
After the bluetooth indicator disappears it sometimes doesn't properly re-appear.
This can be reproduced by running:
I can also reproduce the issue by rapidly switching nightlight on off. You see it sometimes not showing up or even showing only half of the icon:
(Using Enter to switch the button makes this easier)
I noticed I could fix this by commenting the delayed re-ordering:
https://github.com/elementary/wingpanel/blob/master/src/Widgets/IndicatorEntry.vala#L82-L85
But this means the indicator isn't removed and you'll see extra margins.
Removing the previous timeout and increasing the interval helps a great deal. But that means another arbitrary value, which could still give issues on slower systems and adds a delayed sudden jump in the indicators.
I was hoping to find a solution like: #155
This PR's uses the
unmap
signal to know a indicator is hidden, it then start a 0ms timeout to request the menubar reordering. The timeout makes it cancelable when the indicator is quickly made visible again.Still feels like quite a workaround, I'm open for better solutions.
Disconnecting from the
unmap
signal when the indicator is made visible again gave issues for some reason.It could be that a better solution is doing a less crude reordering in the menubar?